package com.qfedu.stock.service.Impl;

import com.qfedu.fmmall.entity.ShoppingCart;
import com.qfedu.fmmall.entity.ShoppingCartVo;
import com.qfedu.stock.dao.ShopCatMapper;
import com.qfedu.stock.service.StockQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class StockQueryServiceImpl implements StockQueryService {

    @Autowired
    private ShopCatMapper shopCatMapper;

    @Override
    public List<ShoppingCartVo> selectShoppcartByCids(String cids) {

        //1.2.3.8
        String[] arr = cids.split(",");
        List<Integer> cidList = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            cidList.add(Integer.parseInt(arr[i]));
        }
        List<ShoppingCartVo> list = shopCatMapper.selectShopCartByCIds(cidList);
        return list;
    }
}
